package com.fit.toysShop.pages;

import java.util.LinkedList;

import com.fit.toysShop.beans.CustomerBean;
import com.fit.toysShop.interfaces.Customer;
import com.fit.toysShop.interfaces.Purchase;
import com.fit.toysShop.service.Customers;

import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;

public class EntryCustomer {
	@Property
	@Persist
	private Customer customer;

	@Inject
	private Customers customers;

	@SetupRender
	public void createObject() {
		customer = new CustomerBean();
		customer.setPurchases(new LinkedList<Purchase>());
	}

	public void onSuccess() {
		customer.executeCustomerCreation(customers);
		//customers.save(customer);
	}
}
